<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>活动管理</title>
    <#include "../../common/link.ftl">
    <script>
        $(function () {

            // 简介查看
            $(".synBtn").click(function () {
                var id = $(this).data('id');
                // 根据id查询简介
                $.get('/activity/getSynopsisById',{id:id},function (data) {
                    //数据复原
                    $("#editForm").clearForm(true);

                    var synopsis = data.data;
                    if(synopsis){
                        $("textarea[name='synopsis']").val(synopsis);
                    }
                    $("#inputSynModal").modal('show');
                })
            })

            // 详细内容查看
            $(".detailBtn").click(function () {
                var id = $(this).data('id');
                // 根据id查看详细内容
                $.get('/activity/getDetailById',{id:id},function (data) {
                    $("#inputModal .modal-body").html(data.data);
                    $("#inputModal").modal('show');
                })
            })

            //删除按钮
            $(".btn-delete").click(function () {
                //获取当前点击的部门id
                var id = $(this).data('id');
                //提示确认框
                $.messager.confirm("警告","是否确认删除?",function () {
                    //发送ajax请求
                    $.get('/activity/delete.do',{id:id},handlerMessage)
                })
            })
        })
    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../../common/navbarAsso.ftl">
    <!--菜单回显-->
    <#assign currentMenu="activity"/>
    <#include "../../common/menuAsso.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>活动信息管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <div style="margin: 10px;">
                    <form class="form-inline" id="searchForm" action="/activity/association/list.do" method="post">
                        <input type="hidden" name="currentPage" id="currentPage" value="1">
                        <div class="form-group">
                            <label for="keyword">关键字：</label>
                            <input type="text" class="form-control" id="keyword" name="keyword" value="${qo.keyword!}" placeholder="请输入活动标题/地点">
                        </div>
                        &nbsp;
                        <div class="form-group">
                            <label for="personStatus"> 活动人数：</label>
                            <select class="form-control" id="personStatus" name="personStatus">
                                <option value="-1">全部</option>
                                <option value="0">未满</option>
                                <option value="1">已满</option>
                            </select>
                            <script>
                                $("#personStatus").val(${qo.personStatus!});
                            </script>
                        </div>
                        &nbsp;
                        <div class="form-group">
                            <label for="applyStatus"> 报名状态：</label>
                            <select class="form-control" id="applyStatus" name="applyStatus">
                                <option value="-1">全部</option>
                                <option value="0">未开始</option>
                                <option value="1">报名中</option>
                                <option value="2">已结束</option>
                            </select>
                            <script>
                              $("#applyStatus").val(${qo.applyStatus!});
                            </script>
                        </div>
                        &nbsp;
                        <div class="form-group">
                            <label for="playStatus"> 活动状态：</label>
                            <select class="form-control" id="playStatus" name="playStatus">
                                <option value="-1">全部</option>
                                <option value="0">未开始</option>
                                <option value="1">活动中</option>
                                <option value="2">已结束</option>
                            </select>
                            <script>
                                $("#playStatus").val(${qo.playStatus!});
                            </script>
                        </div>
                        &nbsp;
                        <div class="form-group">
                            <label for="agreeStatus"> 审核状态：</label>
                            <select class="form-control" id="agreeStatus" name="agreeStatus">
                                <option value="-1">全部</option>
                                <option value="1">需要审核</option>
                                <option value="2">审核通过</option>
                                <option value="3">审核拒绝</option>
                            </select>
                            <script>
                                $("#agreeStatus").val(${qo.agreeStatus!});
                            </script>
                        </div>
                        &nbsp;
                        <button id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询</button>
                        <a href="/activity/association/input.do" class="btn btn-success btn_redirect">
                            <span class="glyphicon glyphicon-plus"></span> 添加
                        </a>
                    </form>
                </div>
                <table class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>编号</th>
                        <th>图片</th>
                        <th>活动标题</th>
                        <th>活动地点</th>
                        <th>所需人数</th>
                        <th>报名人数</th>
                        <th>报名开始时间</th>
                        <th>报名结束时间</th>
                        <th>活动开始时间</th>
                        <th>活动结束时间</th>
                        <th>活动总时长</th>
                        <th>负责人</th>
                        <th>联系方式</th>
                        <th>发布时间</th>
                        <th>简介</th>
                        <th>详细内容</th>
                        <th>发布状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <#list page.list as activity>
                        <tr>
                            <td>${activity_index+1}</td>
                            <td><img src="${(activity.imgUrl)!'/images/default.jpg'}" width="50px" id="imgUrl"></td>
                            <td>${activity.title!}</td>
                            <td>${activity.site!}</td>
                            <td>${(activity.person)!}</td>
                            <td>${(activity.nowperson)!}</td>
                            <td>${(activity.applyStartTime?string('yyyy-MM-dd HH:mm:ss'))!}</td>
                            <td>${(activity.applyEndTime?string('yyyy-MM-dd HH:mm:ss'))!}</td>
                            <td>${(activity.startTime?string('yyyy-MM-dd HH:mm:ss'))!}</td>
                            <td>${(activity.endTime?string('yyyy-MM-dd HH:mm:ss'))!}</td>
                            <td>${(activity.allTime)!}</td>
                            <td>${(activity.dutyName)!}</td>
                            <td>${(activity.mobile)!}</td>
                            <td>${(activity.createTime?string('yyyy-MM-dd HH:mm:ss'))!}</td>
                            <td>
                                <a class="btn btn-info btn-xs synBtn" href="JavaScript:;" data-id="${activity.id}">
                                    <span class="glyphicon glyphicon-th"></span> 查看简介
                                </a>
                            </td>
                            <td>
                                <a class="btn btn-info btn-xs detailBtn" href="JavaScript:;" data-id="${activity.id}">
                                    <span class="glyphicon glyphicon-th"></span> 详细内容
                                </a>
                            </td>
                            <td>
                                <#if  activity.isAgree == 1 >
                                    审核中
                                <#elseif activity.isAgree == 2>
                                    成功
                                <#elseif activity.isAgree == 3>
                                    失败
                                </#if >
                            </td>
                            <td>
                                <a href="/activity/association/input.do?id=${activity.id}" class="btn btn-info btn-xs btn_redirect">
                                    <span class="glyphicon glyphicon-pencil"></span> 编辑
                                </a>
                                <a href="javascript:;" class="btn btn-danger btn-xs btn_delete" data-id="${activity.id}">
                                    <span class="glyphicon glyphicon-trash"></span> 删除
                                </a>
                            </td>
                        </tr>
                    </#list>
                </table>
                <!--分页-->
                <#include "../../common/page.ftl">
            </div>
        </section>
    </div>
    <#include "../../common/footer.ftl">
</div>

<!-- 大图显示 -->
<div id="ShowImage_Form" class="modal fade" >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body" >
            </div>
        </div>
    </div>
</div>


<script>
    $("table img").click(function(){
        var src = $(this).attr("src");
        $("#ShowImage_Form .modal-body").html("<img src='"+src+"' class='carousel-inner img-responsive img-rounded' />");
        $("#ShowImage_Form").modal('show');
    })
</script>
<!-- Modal模态框 -->
<div class="modal fade" id="inputSynModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalSynLabel">查看简介</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="" method="post" id="editForm">
                    <div class="form-group">
                        <div class="col-sm-12">
                            <textarea rows="15" style="min-width: 100%" name="synopsis"></textarea>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="inputModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="myModalLabel">详细内容</h4>
            </div>
            <div class="modal-body" >

            </div>
        </div>
    </div>
</div>

<style>
    #inputModal img{
        width: 570px !important;
    }
</style>

</body>
</html>
